package cn.asura.service.impl;

import cn.asura.pojo.BlogType;
import cn.asura.mapper.BlogTypeMapper;
import cn.asura.service.BlogTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author chen
 * @description
 * @createTime 2020-09-18 23:20
 */
@Component
public class BlogTypeServiceImpl implements BlogTypeService {

    private BlogTypeMapper blogTypeMapper;

    @Autowired
    public void setBlogTypeMapper(BlogTypeMapper blogTypeMapper) {
        this.blogTypeMapper = blogTypeMapper;
    }

    @Override
    public List<BlogType> findAll(int userId, String name, String startTime, String endTime) {
        return blogTypeMapper.findAll(userId, name, startTime, endTime);
    }

    @Override
    public boolean creat(BlogType blogType) {
        return blogTypeMapper.creat(blogType) != 0;
    }

    @Override
    public BlogType findTheUserBlogTypeByTitle(String title, int userId) {
        return blogTypeMapper.findTheUserBlogTypeByTitle(title, userId);
    }

    @Override
    public boolean deleteById(int gid) {
        return blogTypeMapper.deleteById(gid) != 0;
    }

    @Override
    public BlogType findById(int id) {
        return blogTypeMapper.findById(id);
    }

    @Override
    public boolean update(BlogType blogType) {
        return blogTypeMapper.update(blogType) != 0;
    }
}
